/**
 * Alipay.com Inc.
 * Copyright (c) 2005-2010 All Rights Reserved.
 */
package com.losenote.service.req;

import com.losenote.model.ToString;

/**
 * 分页查询基类
 * 
 * @author jingyu.dan
 * @version $Id: PageQueryBase.java,v 0.1 2012-3-2 下午05:47:23 jingyu.dan Exp $
 */
public class PageQuery extends ToString {

    /**serialVersionUID*/
    private static final long serialVersionUID = 1880318557685698363L;

    /** 偏移量转换因子 */
    private static int        CONVERT_FACTOR   = -1;

    /** 页面的显示记录条数 */
    private int               pageSize;

    /** 当前页码 */
    private int               currentPage;

    /**
     * 根据分页信息计算偏移量
     * @param currentPage
     * @param pageSize
     * @return
     */
    public int calculateOffset() {
        return (this.currentPage + CONVERT_FACTOR) * this.pageSize;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

}
